import { defineConfig, loadEnv } from '@farmfe/core';
import vue from '@vitejs/plugin-vue';
import { baseCfg, pluginCfg } from "./farm-config";
type LoadEnvMode = { mode: string }
//https://www.farmfe.org/zh/docs/quick-start
export default async (envMode: LoadEnvMode) => {
  const envMap = loadEnv(envMode.mode, `./farm-env`);
  const pluginMap = await pluginCfg(envMap)
  return defineConfig({
    ...baseCfg(envMap),
    plugins: [...pluginMap.farmPlugin],
    vitePlugins: [vue(), ...pluginMap.vitePlugin]
  });
}